package cn.flant.db.exec;

import java.util.List;
import java.util.Map;

import cn.flant.db.hdle.ResultData;
import cn.flant.db.hdle.ResultSetHandler;

@SuppressWarnings("rawtypes")
public interface DbExecutor {
	public <T> List<T> executeQuery(Class<T> clazz, String sql);

	public <T> List<T> prepareQuery(Class<T> clazz, String sql, Object... params);

	public <T> List<T> executeQuery(ResultSetHandler<T> handler, String sql);

	public <T> List<T> prepareQuery(ResultSetHandler<T> handler, String sql, Object... params);

	public List<Map> executeQuery(String sql);

	public List<Map> prepareQuery(String sql, Object... params);

	public ResultData queryResult(String sql, Object... params);

	public int executeUpdate(String sql);

	public int[] executeUpdate(String... sqls);

	public int prepareUpdate(String sql, Object... params);

	public int[] prepareUpdate(String sql, Object[][] params);

	public <T> List<T> listObject(Class<T> clazz, String[] fields, Object[] params);

	public <T> T loadObject(Class<T> clazz, Object pk);

	public boolean loadObject(Object obj);

	public boolean saveObject(Object obj);

	public boolean updateObject(Object obj, String... fields);

	public boolean deleteObject(Class<?> clazz, Object pk);

	public boolean deleteObject(Object obj);

	public int deleteObject(Class<?> clazz, String[] fields, Object[] params);

	public List<Map> getPageList(String sql, int pageSize, int pageNo, Object... params);

	public <T> List<T> getPageList(Class<?> clazz, String sql, int pageSize, int pageNo, Object... params);

	public ResultData getPageResult(String sql, int pageSize, int pageNo, Object... params);

	public <T> T queryOne(Class<T> clazz, String sql, Object... params);
}
